<%--
  Created by IntelliJ IDEA.
  User: cc
  Date: 2017/6/7
  Time: 上午10:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="java.util.List"%>
<%@page import="com.cc.pojo.Student"%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>所有学生信息</title>
    <style type="text/css">
        td {
            font-size: 12px;
        }

        h2 {
            margin: 0px
        }
    </style>
    <script type="text/javascript">
        function check(form) {
            with (form) {
                if (bookCount.value == "") {
                    alert("请输入更新数量！");
                    return false;
                }
                if (isNaN(bookCount.value)) {
                    alert("格式错误！");
                    return false;
                }
                return true;
            }
        }
    </script> </head>
<body>
<table align="center" width="450" border="1" height="180"
       bordercolor="white" bgcolor="black" cellpadding="1" cellspacing="1">
    <tr bgcolor="white">
        <td align="center" colspan="7">
            <h2>所有学生信息</h2>
        </td>
    </tr>
    <tr align="center" bgcolor="#e1ffc1">
        <td><b>ID</b></td>
        <td><b>姓名</b></td>
        <td><b>年龄</b></td>
        <td><b>性别</b></td>
        <td><b>电话</b></td>
        <td><b>修改</b></td>
        <td><b>删除</b></td>
    </tr>
    <%
        // 获取图书信息集合
        List<Student> list = (List<Student>) request.getAttribute("list");
        // 判断集合是否有效
        if (list == null || list.size() < 1) {
            System.out.println("没有数据！");
        } else {
            // 遍历图书集合中的数据
            for (Student student : list) {
    %>
    <tr align="center"  bgcolor="white">
        <td><%=student.getId()%></td>
        <td><%=student.getName()%></td>
        <td><%=student.getAge()%></td>
        <td><%=student.getSex()%></td>
        <td><%=student.getPhoneNumber()%></td>
        <td>
            <a href="findOneStudent?id=<%=student.getId()%>">修改</a>
        </td>
        <td>
            <a href="deleteStudent?id=<%=student.getId()%>">删除</a>
        </td>


    </tr>
    <%
            }
        }
    %>
</table>
<h2 align="center">
    <a href="index.jsp">添加学生信息</a>
</h2>

</body>

</html>
